package com.bibrApp.difu.actvity.df_u_mvp;


import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
import android.os.AsyncTask;
import android.text.Html;
import android.util.Log;
import android.widget.TextView;

import com.bibrApp.difu.BeemIntent;
import com.bibrApp.difu.R;
import com.bibrApp.difu.actvity.connect_mvp.ConnectActivity;
import com.bibrApp.difu.base.BasePermissionActivity;
import com.bibrApp.difu.proto2javabean.FeatureBean;
import com.bibrApp.difu.utils.ClsPublicUtils;
import com.bibrApp.difu.utils.DialogUtils;
import com.bibrApp.difu.utils.Protocol;
import com.bibrApp.difu.utils.ToastUtils;
import com.google.gson.Gson;
import com.google.protobuf.InvalidProtocolBufferException;
import com.googlecode.protobuf.format.JsonFormat;
import com.gyf.barlibrary.ImmersionBar;
import com.satoshilabs.trezor.lib.protobuf.TrezorMessageManagement;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;


import butterknife.BindView;
import butterknife.OnClick;

public class UActivity extends BasePermissionActivity<UPresenter> implements IUView {

    private ImmersionBar mImmersionBar;
    private Context mContext;
    @BindView(R.id.u_get_tv)
    TextView getUTV;

    @Override
    protected void initPresenter() {
        presenter = new UPresenter(this, this);
        presenter.init();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_my_ud;
    }

    @Override
    public void initView() {
        mContext = this;
        mImmersionBar = ImmersionBar.with(this);
        mImmersionBar.statusBarColor(R.color.white)
                .statusBarDarkFont(true)
                .fitsSystemWindows(true)
                .init();

        getUTV.setText(Html.fromHtml(String.format("%s%s", "没有U盾？", "<font color='#1D89E4'>立即获取 >></font>")));
    }

    @OnClick(R.id.u_sure_btn)
    public void bindClick() {
        startActivity(ConnectActivity.class);
    }

    @OnClick(R.id.u_get_tv)
    public void getUClick() {
        ToastUtils.ShowToast(mContext, "获取U盾");
    }

    @OnClick(R.id.return_iv)
    public void backClick() {
        finish();
    }
    @Override
    public void error(String msg) {
        ToastUtils.ShowToast(mContext, msg);
    }

    @Override
    public void success(String msg) {

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mImmersionBar != null) {
            mImmersionBar.destroy();
        }

        DialogUtils.dismissDialog();
    }

}
